<?php
$this->breadcrumbs=array(
	Yii::t('backend','Thành viên'),
	Yii::t('backend','[Thông tin]'),
);

$this->menu=array(
	array('label'=>NHtml::icon('ss_add') . Yii::t('backend','Thêm'), 'url'=>array('create')),
	array('label'=>NHtml::icon('ss_find') . Yii::t('backend','Tìm kiếm nâng cao'), 'url'=>'#', 'linkOptions'=>array('class'=>'search-button')),
	array('label'=>NHtml::icon('ss_help') . Yii::t('backend','Giúp đỡ'), 'url'=>array('')),
	array('label'=>NHtml::icon('ss_delete') . Yii::t('backend','Xóa'), 'url'=>array('')),	
);
?>
<script type="text/javascript">
$(document).ready(function(){
	$("ul#profile-tabs a[rel='async']").click(function(){
		if($(this).next().html()!="")
		{
			$(this).hide().next().show();
			return false;
		}

		$.ajax({
			url:$(this).attr('href'),
			context:$(this),
			success:function(data) {
				$(this).hide().next().html(data).show();
			}
		});

		return false;
	});
	
	$("ul#profile-tabs").on('change', 'form', function(){
		if(FormChanges($(this).attr('id')).length==0)
			$(this).find(".buttonSubmit").removeClass("g-button-submit");
		else
			$(this).find(".buttonSubmit").addClass("g-button-submit");
	});

	$("ul#profile-tabs").on('click', 'input.buttonSubmit', function(){
		var $_form = $(this).parents("form");

		if(FormChanges($_form.attr('id')).length==0) return false;

		$.ajax({
			url:$_form.attr("action"),
			cache:false,
			type:"POST",
			data:$_form.serialize(),
			context:$(this),
			success:function(data) {
				$content_div = $_form.parent();
				$content_div.html("").hide().prev().show();
				$content_div.prev().children(".itemSuccess").fadeIn("fast").delay(2000).fadeOut("fast");
			}
		});
		return false;
	});

	$("ul#profile-tabs").on('click', 'input.buttonReset', function(){
		var $_form = $(this).parents("form");
		$content_div = $_form.parent();
		$content_div.hide().prev().show();

		$_form.find(".buttonSubmit").removeClass("g-button-submit");
	});
});
</script>

<?php echo CHtml::link(NHtml::icon('ss_delete') . Yii::t('user','Xóa tài khoản thành viên'),'#',
	array("id"=>"btn-delete", "submit"=>array("delete", 'id'=>$model->id),'confirm'=>Yii::t('user','Chắc chắn xóa thành viên này?'), 'class'=>'g-button mrs')); ?>
<?php if($model->id!=Yii::app()->user->id) 
	echo CHtml::link(NHtml::icon('') . Yii::t('user','Đăng nhập vào tài khoản của {thanhvien}', array('{thanhvien}'=>$model->name)), array('adminLogin','id'=>$model->id),array('class'=>'g-button')); 
	else
		echo Yii::t('user','(Đang đăng nhập)');
	?>

<ul id="profile-tabs">
	<li class='clearfix'>
		<a rel="async" href="<?php echo $this->createUrl('basicInfo') ?>" class="clearfix pvm phs">
			<span class='itemLabel'>Thông tin cơ bản</span>
			<span class='itemEdit'><?php echo Yii::t('user','Xem và chỉnh sửa') ?></span>
			<span class='itemValue'>Mật khẩu - Email - Tên thành viên - v.v...</span>
		</a>
		<div class='content'></div>
	</li>
	
	<li class='clearfix'>
		<a rel="async" href="<?php echo $this->createUrl('gmailInfo') ?>" class="clearfix pvm phs">
			<span class='itemLabel'>Thông tin Gmail Connect</span>
			<span class='itemEdit'><?php echo Yii::t('user','Xem thông tin') ?></span>
			<span class='itemValue'></span>
		</a>
		<div class='content'></div>
	</li>
	
	<li class='clearfix'>
		<a rel="async" href="<?php echo $this->createUrl('yahooInfo') ?>" class="clearfix pvm phs">
			<span class='itemLabel'>Thông tin Yahoo Connect</span>
			<span class='itemEdit'><?php echo Yii::t('user','Xem thông tin') ?></span>
			<span class='itemValue'></span>
		</a>
		<div class='content'></div>
	</li>
	
	<li class='clearfix'>
		<a rel="async" href="<?php echo $this->createUrl('zingInfo') ?>" class="clearfix pvm phs">
			<span class='itemLabel'>Thông tin Zing Connect</span>
			<span class='itemEdit'><?php echo Yii::t('user','Xem thông tin') ?></span>
			<span class='itemValue'></span>
		</a>
		<div class='content'></div>
	</li>
	
	<li class='clearfix'>
		<a rel="async" href="<?php echo $this->createUrl('facebookInfo') ?>" class="clearfix pvm phs">
			<span class='itemLabel'>Thông tin Facebook Connect</span>
			<span class='itemEdit'><?php echo Yii::t('user','Xem thông tin') ?></span>
			<span class='itemValue'></span>
		</a>
		<div class='content'></div>
	</li>
	 
	 <li class='clearfix'>
		<a rel="async" href="<?php echo $this->createUrl('updateGroup',array('id'=>$model->id)) ?>" class="clearfix pvm phs">
			<span class='itemLabel'><?php echo CHtml::activeLabel($model, 'group') ?></span>
			<span class='itemEdit'><?php echo Yii::t('user','Chỉnh sửa') ?></span>
			<span class='itemSuccess right mrm hide'><?php echo Yii::t('user','Đã cập nhật') ?></span>
			<span class='itemValue'>
				<?php echo CHtml::activeLabel($model, 'group_id') ?> -  
				<?php echo CHtml::activeLabel($model, 'display_group_id') ?> - 
				<?php echo CHtml::activeLabel($model, 'group_ids') ?>
			</span>
		</a>
		<div class='content'></div>
	</li>

</ul>